<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/3/20
 * Time: 18:13
 */
namespace app\admin\model;

use think\Model;

class BaseModel extends Model
{
    public $page = 1;
    public $limitStart = 0;
    public $limit = 10;
    public $count = 0;

    protected function initialize(){

    }

    //根据页码计算Limit
    protected function getLimitStart($page = ''){
        $this->page = intval($page) <= 0 ? 1 : intval($page);
        $this->limitStart = $this->page == 1 ? 0 : ($page-1) * $this->limit + 1;
        return $this->limitStart;
    }

}